package com.wcards.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcards.service.AdoptInfoService;
import com.wcards.config.R;
import com.wcards.entity.AdoptInfo;
import com.wcards.mapper.AdoptInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
领养信息表
 * @author q'y
 */
@Service
public class AdoptInfoServiceImpl extends ServiceImpl<AdoptInfoMapper, AdoptInfo> implements AdoptInfoService {
    @Autowired
    private AdoptInfoMapper adoptInfoMapper;
    @Autowired
    private AdoptInfoService adoptInfoService;
    /**
    分页查询所有的领养信息
    */
    @Override
    public R<Page<AdoptInfo>> getAdoptInfo(Long current, Long size) {
        Page<AdoptInfo> page = new Page<>(current, size);

        Page<AdoptInfo> aPage = adoptInfoService.page(page);
        return R.success(aPage);
    }
    /**通过领养编号删除*/
    @Override
    public R<String> removeByAnum(Integer aNumber) {
        int i = adoptInfoMapper.deleteById(aNumber);
        if (i>0)
        {
            return R.success("删除成功");
        }
        return R.error("删除失败,没有这个编号",400);
    }
}
